﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace HengTong.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class 组织和部门新增排序 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<decimal>(
                name: "Order",
                table: "SysOrg",
                type: "decimal(4,2)",
                nullable: true,
                oldClrType: typeof(decimal),
                oldType: "decimal(4,2)");
            
            migrationBuilder.Sql("UPDATE FrameworkGroups SET [Order] = 99 WHERE [Order] IS NULL");
            migrationBuilder.Sql("UPDATE SysOrg SET [Order] = 99 WHERE [Order] = 0.00");
            migrationBuilder.Sql("UPDATE SysOrg SET [Order] = 99 WHERE [Order] IS NULL");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterColumn<decimal>(
                name: "Order",
                table: "SysOrg",
                type: "decimal(4,2)",
                nullable: false,
                defaultValue: 0m,
                oldClrType: typeof(decimal),
                oldType: "decimal(4,2)",
                oldNullable: true);
        }
    }
}
